﻿package extremefx.ui {
	import flash.text.TextFormatAlign;	
	
	/**
	 * @author Marcelo Volmaro
	 */
	public final class UIAlign {
		public static const TOP:uint = 2;
		public static const MIDDLE:uint = 1;
		public static const BOTTOM:uint = 4;
		
		public static const LEFT:uint = 8;
		public static const CENTER:uint = 16;
		public static const RIGHT:uint = 32;
		
		/**
		 * ShortCuts
		 */
		public static const TOP_LEFT:uint = 10;
		public static const TOP_CENTER:uint = 18;
		public static const TOP_RIGHT:uint = 34;
		
		public static const MIDDLE_LEFT:uint = 9;
		public static const MIDDLE_CENTER:uint = 17;
		public static const MIDDLE_RIGHT:uint = 33;
		
		public static const BOTTOM_LEFT:uint = 12;
		public static const BOTTOM_CENTER:uint = 20;
		public static const BOTTOM_RIGHT:uint = 36;
		
		public static function convert(pH:String, pV:String):uint {
			var val:uint = LEFT;
			switch(pH){
				case TextFormatAlign.RIGHT:
					val = RIGHT;
					break;
					
				case TextFormatAlign.CENTER:
					val = CENTER;
			}
			
			switch (pV){
				case "bottom":
					val |= BOTTOM;
					break;
					
				case "middle":
					val |= MIDDLE;
					break;
					
				default:
					val |= TOP;
			}
			
			return val;
		}
	}
}
